package com.dartfar.workflow.action;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import net.sf.json.JSONArray;

import com.dartfar.base.action.BaseAction;
import com.dartfar.workflow.service.WorkflowHistoryService;
import com.dartfar.workflow.vo.WorkflowHistoryVo;

/**
 * 流程历史记录Action
 * @author 王琦
 *
 */

@Scope("prototype")
@Component("workflowHistoryAction")
public class WorkflowHistoryAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Resource
	private WorkflowHistoryService workflowHistoryService;

	private int id;
	private int wpfmId;
	
	/**
	 * 查找历史信息
	 */
	public void findHistory(){
		List<WorkflowHistoryVo> historys = workflowHistoryService.findHistory(wpfmId, id, true);
		
		String jsonResult = JSONArray.fromObject(historys).toString();
		try{
			response.getWriter().write(jsonResult);
		}catch(Exception e){
			e.printStackTrace();
		}
		//toWrite(JsonBuilder.getInstance().buildObjListToJson((long)historys.size(), historys, true));
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getWpfmId() {
		return wpfmId;
	}

	public void setWpfmId(int wpfmId) {
		this.wpfmId = wpfmId;
	}


	
}
